import http from './http'
import axios from 'axios'
// 发送邮件验证码
export function sendEmailCode(data) {
  return axios({
    method: 'post',
    url: '/users/sendEmail',
    data
  })
}
// 注册接口
export function userRegister(data) {
  return axios({
    method: 'post',
    url: '/users/register',
    data
  })
}
// 登录接口
export function userLogin(data) {
  return axios({
    method: 'post',
    url: '/users/login',
    data
  })
}
// 获取用户信息
export function getUserInfo(data) {
  return axios({
    method: 'get',
    url: '/users/getUserInfo',
    params: {
      data
    }
  })
}
// 提交文章
export function sendArticle(data) {
  return axios({
    method: 'post',
    url: '/article/sendArticle',
    data
  })
}
// 上传到题库
export function sendQuestion(data) {
  return axios({
    method: 'post',
    url: '/questions/sendQuestion',
    data
  })
}
// 上传到题库
export function getQuestions(data) {
  return axios({
    method: 'get',
    url: '/questions/getQuestions',
    params: {
      data
    }
  })
}
// 查询某一ID的题目详情
export function getQuestionDetail(data) {
  return axios({
    method: 'get',
    url: '/questions/getQuestionsDetail',
    params: {
      data
    }
  })
}
//收藏题库
export function collectQuestion(data) {
  return axios({
    method: 'post',
    url: '/questions/collectQuestion',
    data
  })
}
//取消收藏题库
export function noCollectQuestion(data) {
  return axios({
    method: 'post',
    url: '/questions/noCollectQuestion',
    data
  })
}
//获得所有已经收藏的题
export function getAllCollectQuestion(data) {
  return axios({
    method: 'post',
    url: '/questions/getAllCollectQuestion',
    data
  })
}
//获得所有面经
export function getArticle(data) {
  return axios({
    method: 'get',
    url: '/article/getArticle',
    params: {
      data
    }
  })
}
//获得某一篇面经详情
export function getArticleDetail(data) {
  return axios({
    method: 'get',
    url: '/article/getArticleDetail',
    params: {
      data
    }
  })
}
//收藏面经
export function collectArticle(data) {
  return axios({
    method: 'post',
    url: '/article/collectArticle',
    data
  })
}
//取消收藏面经
export function noCollectArticle(data) {
  return axios({
    method: 'post',
    url: '/article/noCollectArticle',
    data
  })
}

//  获取我的发布列表
export function myArticle(data) {
  return axios({
    method: 'post',
    url: '/article/myArticle',
    data
  })
}
//  获取我的收藏列表
export function getCollectArticle(data) {
  return axios({
    method: 'post',
    url: '/article/getCollectArticle',
    data
  })
}
//  获取热门题目
export function getHostQuestions(data) {
  return axios({
    method: 'post',
    url: '/questions/getHostQuestions',
    data
  })
}
//  获取热门面经
export function getHotArticles(data) {
  return axios({
    method: 'post',
    url: '/article/getHotArticle',
    data
  })
}
//  删除面经
export function deleteArticle(data) {
  return axios({
    method: 'post',
    url: '/article/deleteArticle',
    data
  })
}
